package com.hy.mvc.biz.task;


import com.alibaba.fastjson.JSON;
import com.hy.mvc.biz.service.manager.UUserDOManager;
import com.hy.mvc.biz.service.mapper.UUserDOMapper;
import com.hy.mvc.biz.task.base.TimerTask;
import com.hy.mvc.domain.dataobject.UUserDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * <pre>
 *    author  : Booker
 *    time    : 2017/12/4 14:02
 *    desc    : 输入描述
 *    version : v1.0
 * </pre>
 */
@Component
public class MvcTask implements TimerTask {

    @Value("${hotelDomain}")
    private String domain;

    @Autowired
    private UUserDOMapper uUserDOMapper;

    @Resource
    private UUserDOManager uUserDOManager;

    /**
     * 定时任务
     *
     * @throws Exception
     */
    @Override
    public void taskJob() throws Exception {
        UUserDO uUserDO = uUserDOMapper.selectByPrimaryKey(1L);
        System.out.println(domain);
        UUserDO uUserDO1 = uUserDOManager.findById(1L);
        System.out.println(uUserDO.getName() + "***" + uUserDO.getAge());
        System.out.println("user is " + uUserDO1.toString());
        System.out.println("user is " + JSON.toJSONString(uUserDOManager.findAllValidUUserDO()));

    }
}
